<template>
  <div>
    <!-- 图 -->
    <div class="main" v-if="arr.community">
      <div class="entry">
        <img
          :src="`http://www.xiaoshuaipeng.com:8080${arr.houseImg[0]}`"
          alt=""
        />
        <div class="header">
          <p @click="$router.back()">返回</p>
          <h3>{{ arr.community }}</h3>
          <p>打印</p>
        </div>
      </div>
      <div class="content">
        <div class="head">
          <h4>{{ arr.title }}</h4>
          <span class="freestyle">随时看房</span>
        </div>
        <div class="zhong">
          <ul>
            <li>
              <span>{{ arr.price }}<i>/月</i></span>
              <p>租金</p>
            </li>
            <li>
              <span>{{ arr.roomType }}</span>
              <p>房型</p>
            </li>
            <li>
              <span>{{ arr.size }}平米</span>
              <p>面积</p>
            </li>
          </ul>
        </div>
        <div class="foot">
          <p>装修：精装</p>
          <p>朝向：{{ arr.oriented[0] }} {{ arr.oriented[1] }}</p>
          <p>楼层：{{ arr.floor }}</p>
          <p>类型：普通住宅</p>
        </div>
      </div>
    </div>
    <div class="footer">
      <ul>
        <li>收藏</li>
        <li>在线咨询</li>
        <li>电话预约</li>
      </ul>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'DetailPage',
  data () {
    return {
      arr: {}
    }
  },
  async created () {
    const id = this.$route.params.id
    console.log(this.$route.params)
    const { data } = await axios.get(
      `http://www.xiaoshuaipeng.com:8080/houses/${id}`
    )
    console.log(data.body)
    this.arr = data.body
  }
}
</script>

<style lang="less" scoped>
.main {
  padding-bottom: 50px;
  .entry {
    img {
      width: 100%;
      height: 252px;
      // background-color: skyblue;
    }
    .header {
      width: 100%;
      color: #fff;
      position: absolute;
      left: 0;
      top: 10px;
      display: flex;
      justify-content: space-around;
      align-items: center;
      h3 {
        font-weight: 400;
        font-size: 16px;
      }
    }
  }
  .content {
    height: 245px;
    padding: 15px;
    // background-color: pink;
    .head {
      h4 {
        font-weight: 400;
        color: #000;
      }
      .freestyle {
        font-size: 14px;
        color: #39becd;
        background-color: #e1f5f8;
      }
    }
    .zhong {
      margin: 15px;
      padding: 15px;
      border-top: 1px solid #ccc;
      border-bottom: 1px solid #ccc;
      ul {
        list-style: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        li {
          text-align: center;
          span {
            font-size: 18px;
            color: #fa5741;
            i {
              font-size: 12px;
            }
          }
          p {
            font-size: 14px;
            color: #999;
          }
        }
      }
    }
    .foot {
      display: flex;
      flex-wrap: wrap;
      p {
        width: 50%;
        margin-top: 10px;
      }
    }
  }
}
.footer {
  width: 100%;
  height: 50px;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 999;
  ul {
    display: flex;
    justify-content: space-between;
    text-align: center;
    list-style: none;
    line-height: 50px;
    li {
      width: 33.33%;
      text-decoration: none;
      color: #999;
      border: 1px solid #ccc;
      border-right: none;
      &:nth-child(3) {
        color: #fff;
        background-color: #21b97a;
      }
    }
  }
}
</style>
